package com.riguz.forks.framework.mvc.impl;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.riguz.forks.framework.mvc.ExceptionHandler;

public class DefaultExceptionHandler implements ExceptionHandler{
    private static final Logger logger = LoggerFactory.getLogger(DefaultExceptionHandler.class);
    
    @Override
    public void handleException(HttpServletRequest request, HttpServletResponse response, Exception ex) {
        try {
            logger.debug("Resolving exception:");
            ex.printStackTrace();
            response.sendError(500, ex.getMessage());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    
}
